﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<form id="form1">
    <div style="padding-top: 10px; margin-right: 10px;">
        <table class="form">
            <tr>
                <th class="formTitle">归属组织</th>
                <td class="formValue">
                    <select id="OrganizeId" name="OrganizeId" class="form-control"></select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">岗位名称</th>
                <td class="formValue">
                    <input id="FullName" name="FullName" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入岗位名称" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">岗位编号</th>
                <td class="formValue">
                    <input id="EnCode" name="EnCode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入岗位编号" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">显示顺序</th>
                <td class="formValue">
                    <input id="SortCode" name="SortCode" type="text" class="form-control" isvalid="yes" checkexpession="Num" placeholder="请输入显示顺序" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" style="height: 35px;">选项</th>
                <td class="formValue" style="padding-top: 1px;">
                    <div class="checkbox user-select">
                        <label>
                            <input id="AllowEdit" name="AllowEdit" type="checkbox" />
                            允许编辑
                        </label>
                        <label>
                            <input id="AllowDelete" name="AllowDelete" type="checkbox" />
                            允许删除
                        </label>
                        <label>
                            <input id="EnabledMark" name="EnabledMark" type="checkbox" checked="checked" />
                            有效
                        </label>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 5px;">
                    备注
                </th>
                <td class="formValue">
                    <textarea id="Description" name="Description" class="form-control" style="height: 60px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
    var keyValue = $.fn.request("keyValue");
    $(function () {
        initControl();
        if (!!keyValue) {
            $.fn.setForm({
                url: "/SystemManage/Duty/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);
                }
            });
        }
    })
    function initControl() {
        $("#OrganizeId").bindSelect({
            url: "/SystemManage/Organize/GetTreeSelectJson",
        });
    }
    //添加
    function submitForm() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var data = $("#form1").GetWebControls();
        $.fn.submitForm({
            url: "/SystemManage/Duty/SubmitForm?keyValue=" + keyValue,
            param: data,
            loading: "正在保存数据...",
            success: function () {
                $.currentIframe().$("#gridTable").resetSelection();
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
            }
        });
    }
</script>
